﻿@model List<MovieReview.DataModels.Movie>
@{
    ViewBag.Title = "Home Page";
}

<div class="jumbotron"><h1>Welcome To Movie Review Central</h1></div>
<table class="table table-hover table-condensed">
    <tr>
        <th colspan="4" class="text-center">
            <h2>List of Movies</h2>
            <div>
                <button class="pull-right btn btn-success" onclick="location.href='/Home/AddMovie'">Add Movie</button>
            </div>
        </th>
    </tr>
    <tr>
        <th class="col-md-2">Movie Poster</th>
        <th>Movie Title</th>
        <th>Average Rating</th>
    </tr>
    @foreach (var c in Model)
    {
        <tr onclick="location.href='/Home/Details/@c.Id'">
            <td style="height:100px;width:100px;"><img class="img-responsive" src="@c.Image" /></td>
            <td class="text-center"><br /><br /><br /><br />@c.Title</td>
            <td class="text-center">
                @if (@c.Rating == 1)
                {<br /><br /><br /><br />
                    <div>&#9733&#9734&#9734&#9734&#9734</div><br />
                }
                else if (@c.Rating == 2)
                {<br /><br /><br /><br />
                    <div>&#9733&#9733&#9734&#9734&#9734</div><br />
                }
                else if (@c.Rating == 3)
                {<br /><br /><br /><br />
                    <div>&#9733&#9733&#9733&#9734&#9734</div><br />
                }
                else if (@c.Rating == 4)
                {<br /><br /><br /><br />
                    <div>&#9733&#9733&#9733&#9733&#9734</div><br />
                }
                else if (@c.Rating == 5)
                {<br /><br /><br /><br />
                    <div>&#9733&#9733&#9733&#9733&#9733</div><br />
                }
                else if (@c.Rating == 0)
                {<br /><br /><br /><br />
                    <div>&#9734&#9734&#9734&#9734&#9734</div><br />
                }
            </td>
        </tr>
    }
</table>